
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

> ### Jonathan D. Klingler, Gary E. Hollibaugh, Jr., and Adam J. Ramey
> ### "Don't Know What You Got: A Bayesian Hierarchical Model of Neuroticism and Ideological Uncertainty
> ### Political Science Research and Methods
> ###
> ###
> ### Bootstrapped Aldrich-McKelvey Estimation Code
> ### Description: This file estimates bootstrapped Aldrich-McKelvey estimates.
> ###
> ### Note 1: Run the Preprocessing_and_Summary.R file beforehand to generate the CCES2014.Rda file.
> ### Note 2: Make sure the directories are set up properly and that all files are in this file's directory.
> ### Note 3: For ease of use, a template script file called AMBoot.sh is included in the "Cluster Scripts" directory.
> ### Note 4: This file will start a process that will take several hours to complete, so a cluster might be recommended.
> 
> 
> rm(list=ls())
> ptm <- proc.time()
>
>
> # code to generate bootstrapped aldrich-mckelvey estimates
> # (intended to be sent to a cluster since it takes a while)
>
> library(basicspace)
Loading required package: tools

## BASIC SPACE SCALING PACKAGE
## 2009 - 2015
## Keith Poole, Howard Rosenthal, Jeffrey Lewis, James Lo, and Royce Carroll
## Support provided by the U.S. National Science Foundation
## NSF Grant SES-0611974

> load("CCES2014.Rda")
> 
> # standard aldrich-mckelvey
> # need to remove those where a question wasn't asked (coded as 10)
> # otherwise will make paul and cruz look too far right
> newcces <- cces[!is.na(cces$self_emoti) & !is.na(cces$self_consc) & !is.na(cces$self_agree) 
+                 & !is.na(cces$self_extra) & !is.na(cces$self_openn) & !is.na(cces$CC421a) 
+                 & !is.na(cces$newsint) 
+                 & !(cces$CC334C == "Not Asked") 
+                 & !(cces$CC334D == "Not Asked") 
+                 & !(cces$CC334E == "Not Asked") 
+                 & !(cces$CC334F == "Not Asked") 
+                 & !(cces$CC334G == "Not Asked") 
+                 & !(cces$CC334K == "Not Asked") 
+                 & !(cces$CC334L == "Not Asked") 
+                 & !(cces$CC334M == "Not Asked") 
+                 & !(cces$CC334W == "Not Asked"),]
> 
> 
> aldmckspace <- cbind(as.numeric(newcces$CC334A), # self
+                      as.numeric(newcces$CC334C), # obama
+                      as.numeric(newcces$CC334D), # clinton
+                      as.numeric(newcces$CC334E), # cruz
+                      as.numeric(newcces$CC334F), # paul
+                      as.numeric(newcces$CC334G), # bush
+                      as.numeric(newcces$CC334K), # demparty
+                      as.numeric(newcces$CC334L), # repparty
+                      as.numeric(newcces$CC334M), # teaparty
+                      as.numeric(newcces$CC334W)) # scotus
> 
> 
> colnames(aldmckspace) <- c("Self", "Obama", "Clinton", "Cruz", "Paul", "Bush", "Democrats", "Republicans", "Tea Party", "Supreme Court")
> 
> set.seed(1)
> aldmck.ests <- aldmck(aldmckspace, respondent = 1, polarity = 2, missing = c(8, 9, 10))$stimuli
> aldmck.ests.rescale <- 2*(aldmck.ests - aldmck.ests[1])/(aldmck.ests[3] - aldmck.ests[1]) - 1
> n.boot <- 200000
> aldmck.boot <- boot_aldmck(aldmckspace, respondent = 1, polarity = 2, missing = c(8, 9, 10), iter = n.boot) 
> save(aldmck.boot, file = "AMBoot.Rda")
> 
> proc.time()
     user    system   elapsed 
17334.575     3.047 17401.457 
